package com.typhoon.spring_shiro.constants;

/**
 * Created by hujun on 2017/2/15.
 */
public enum LoginErrCode {
    S_OK(0,"登录成功"),
    S_PARAM_ERR(100,"参数非法"),
    S_USER_PASS_NOT_OK(200,"用户名或密码错误"),
    S_NOT_ALLOWED_LOGIN(300,"访问受限"),
    S_ID_NOT_EXIST(401,"你要登录的工号并不存在"),
    S_OA_LOGIN_ERR(901,"OA登录异常"),
    S_SYS_ERR(999,"系统异常");

    public static LoginErrCode valueOf(int status) {
        switch (status) {
            case 0:
                return S_OK;
            case 100:
                return S_PARAM_ERR;
            case 200:
                return S_USER_PASS_NOT_OK;
            case 300:
                return S_NOT_ALLOWED_LOGIN;
            case 401:
                return S_ID_NOT_EXIST;
            case 999:
                return S_SYS_ERR;
            case 901:
                return S_OA_LOGIN_ERR;
        }
        return null;
    }

    private int code;
    private String msg;

    LoginErrCode(int code,String msg){
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
